refactor: evolve salt into raystack service framework#85
Open
refactor: evolve salt into raystack service framework#85
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Evolves salt from a bag of independent utilities into the standard way to build raystack services and CLIs. Drops unused packages, adds bootstrap entry points, modernizes dependencies.
18 packages, 52 files, 7060 lines. Down from 25+ packages.
Service bootstrap (
app/)H2C and health check at
/pingby default. No hidden middleware — everything is explicit.CLI bootstrap (
cli/)Initadds help, completion, reference docs, and silences Cobra's default error/usage output.Executeruns the command and handles all errors with proper exit codes — sentinel errors (ErrSilent,ErrCancel), flag errors (with contextual usage), and general errors. Commands access shared output viacli.Output(cmd)and prompting viacli.Prompter(cmd).Error handling
cli.Executeowns all error dispatch:cli.ErrSilentcli.ErrCancelFlagError,HandleError,NewFlagError, andcommander.IsCommandErrare removed — their functionality is internal toInit/Execute.New packages
app/— service lifecycle with graceful shutdowncli/— CLI lifecycle withInit+Executeserver/— h2c HTTP server with health checks, timeouts, middleware supportmiddleware/— recovery, requestid, requestlog, errorz, cors (Connect + HTTP)Packages dropped (zero consumers)
db/— projects use their own DB libraryauth/oidc/— incomplete, tracked in feat: CLI authentication — login, token storage, auto-refresh #86auth/audit/— too simple, tracked in feat: standardized audit logging schema and service #87testkit/— projects use dockertest directlyobservability/logger/— use*slog.Loggerfrom stdlibobservability/otelgrpc/— use otelconnectobservability/otelhttpclient/— use otelhttpserver/mux/— replaced by new h2c serverPackages restructured
observability/telemetry/cli/terminatorcli/terminalcli/promptercli/promptcli/releasercli/versionPackages improved
config/— upgraded validator v9→v10, replaced unmaintained go-defaults, removed stdout printingcli/printer/— rewritten as Output type (testable, writer-based)cli/prompt/— migrated from archived survey/v2 to charmbracelet/huhserver/— read/write/idle timeouts, WithServer passthroughCode modernization
interface{}→anyacross all packagesos.IsNotExist→errors.Is(err, fs.ErrNotExist)sort.Slice→slices.SortFuncSilenceErrors/SilenceUsageset inInit(follows gh CLI pattern)Dependencies
Removed: zap, logrus, survey/v2, tablewriter, oklog/run, safeexec, pkg/errors, go-defaults, sqlx, golang-migrate, dockertest
Added: connectrpc.com/connect, charmbracelet/huh, creasty/defaults
Upgraded: cobra v1.8→v1.10, validator v9→v10, glamour v0.3→v1.0, termenv v0.11→v0.16, spinner v1.18→v1.23, progressbar v3.8→v3.19
CI
golangci-lint v1.60→v2.11, Go 1.22→1.24, dropped errcheck linter.
Docs
Test plan
go build ./...passesgo vet ./...cleangolangci-lint run ./...— 0 issuesgo test ./...— all passapp.Run()andcli.Execute()